<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateRoastsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //吐槽、建议
        Schema::create('roasts', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->index()->default(0)->comment('用户ID');
            $table->string('roast_txt')->default('')->comment('吐槽内容');
            $table->string('praise_txt')->default('')->comment('夸赞内容');
            $table->integer('status')->default(0)->comment('处理状态');
            $table->string('mark')->default('')->comment('备注');
            $table->timestamps();
        });
        Schema::create('roast_images', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('roast_id')->index()->default(0)->comment('吐槽ID');
            $table->string('img_url')->default('')->comment('图片地址');
            $table->timestamps();
        });

        //错误上报
        Schema::create('reports', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->index()->default(0)->comment('用户ID');
            $table->integer('book_id')->index()->default(0)->comment('书籍ID');
            $table->integer('book_chapter_id')->index()->default(0)->comment('章节ID');

            $table->string('en_word')->default('')->comment('单词');
            $table->string('opt_desc')->default(0)->comment('错误选项问题');
            $table->string('other_desc')->default(0)->comment('其他问题');
            $table->integer('status')->default(0)->comment('处理状态');
            $table->string('mark')->default('')->comment('备注');
            $table->timestamps();
        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('roasts');
    }
}
